<?php


namespace app\api\controller;
use think\Db;

class Statistics
{
    /**
     * 充值统计
     * date
     */
    public function recharge_statistics() {
        $date = input('date', '');
        $type = input('type', 'd');
        $list['date'] = explode(' - ', $date);
        $weekArr = custom_time($list['date'], $type);
        $count = [];
        $week = [];
        foreach ($weekArr as $vo) {
            $week[] = $vo['value'];
        }
        $list['count'] = $count;
        $list['week'] = $week;
        return json($list);
    }

    /**
     * 近7天充值用户中首充用户堆积图
     * date
     */
    public function user_recharge_repeatedly() {
        $date = input('date', '');
        $type = input('type', 'd');
        $list['date'] = explode(' - ', $date);
        $weekArr = custom_time($list['date'], $type);
        $count = [];
        $week = [];
        foreach ($weekArr as $vo) {
            $week[] = $vo['value'];
        }
        $list['count'] = $count;
        $list['week'] = $week;
        return json($list);
    }
}